Some computer program environments provide runtime support for reflection, type introspection, dynamic dispatch, dynamic type-checking, and/or other dynamic behaviors. Dynamic dispatch involves selecting at runtime which implementation of a polymorphic method (or function) is called from a given invocation. Type introspection involves a running program examining its own values, metadata, properties, and/or functions; reflection goes further because it involves a running program altering its own values, metadata, properties, and/or functions. Dynamic type-checking involves verifying type-safety of a program while the program is running. Some environments rely on Just-in-time (JIT) compilation to support dynamic behavior by compiling code for a program while the program is running; the compiled code may be native code or it may be higher-level code which is then interpreted, for example.
Balancing dynamic and static features in an environment can be challenging. Balance is sometimes possible, in the sense that a program with dynamic behaviors may also have features such as static type-checking, static compilation, and/or creation of an executable application all of whose components have been identified during an ahead-of-time compilation before the application begins execution. Dynamic features can provide flexibility and power which is missing from familiar statically compiled programs. In many situations, however, static compilation of a program permits a smaller and less complex runtime, and provides greater certainty about the program's behavior during testing and/or when checking the program for malware. Accordingly, new ways to balance static and dynamic functionality can be useful and concrete advances in computer programming.